/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Library General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301,  USA
 */

#include <Elementary.h>
#include "dbsqlite.h"

void create_gui(Evas_Object *win);
void set_category(void *data, Evas_Object *obj, void *event_info);
void log_app(void *data, Evas_Object *obj, void *event_info);

extern char launcher_dir[255], wall_path[255];
extern char app_sms[255], app_calls[255];
extern int int_sms, int_log, int_con, show_c_no;

_act_element act_el[5], con_data, *pass_data;
_add_edit_con con_save;
_sms_re Re;
char con_val[255], con_cat[255], pref_grp[5][255];

Elm_Toolbar_Item *tb_item, *log_tb_item, *cat_tb_item;
Elm_Genlist_Item_Class itc_dir_list, itc_log, itc_act, itc_conv, itc_seq_list, itc_list, itc2, itc_contact;
Elm_Genlist_Item_Class itc_sms_rec, itc_con_cat;
Evas_Object *dir_browser_page_win, *bg, *lb_wall, *hs, *app_bt, *tb, *cat_bt, *app_lb, *hv, *list, *tb_hbox;
Evas_Object *fr, *noti_hbox, *popup_bt, *cat_list, *cb_sms, *cb_log, *lb_loc, *pref_vbox, *popup_lb;
Evas_Object *cat_dialog, *cat_hv_bx, *clock_lb, *date_lb, *sc, *vbox, *vbox_right, *vbox_left, *noti_win; 
Evas_Object *contact_list, *jump_win, *win_sms, *contact_win, *cb_con, *cb_channel, *cb_hs, *vbox_sms;
Evas_Object *act_win, *pop_win, *warn_win, *seq_list, *ly_right, *show_apps_win, *main_edje, *set_win, *pref_tb;

void get_contact_name(char *num, char *ty);
void set_contact(void *data, Evas_Object *obj, void *event_info);

extern void dir_list_select(void *data, Evas_Object *obj, void *event_info);
extern void up_button_clicked(void *data, Evas_Object *obj, void *event_info);
extern void home_button_clicked(void *data, Evas_Object *obj, void *event_info);
extern void add_dir_button_clicked(void *data, Evas_Object *obj, void *event_info);
extern void cancel_button_clicked(void *data, Evas_Object *obj, void *event_info);
extern void load_dir(Evas_Object *li, char *direc);
extern void app_select(void *data, Evas_Object *obj, void *event_info);
extern void seq_move_up(void *data, Evas_Object *obj, void *event_info);
extern void seq_move_down(void *data, Evas_Object *obj, void *event_info);
extern void set_sms_clicked(void *data, Evas_Object *obj, void *event_info);
extern void set_call_clicked(void *data, Evas_Object *obj, void *event_info);
extern void done_clicked(void *data, Evas_Object *obj, void *event_info);
extern void set_time_format(void *data, Evas_Object *obj, void *event_info);
extern void set_date_format(void *data, Evas_Object *obj, void *event_info);
extern void set_cb_subs(void *data, Evas_Object *obj, void *event_info);
extern void cat_dialog_add(void *data, Evas_Object *obj, void *event_info);
extern void cat_win_del(void *data, Evas_Object *obj, void *event_info);
extern void cat_dialog_ren(void *data, Evas_Object *obj, void *event_info);
extern void del_cat_button_clicked(void *data, Evas_Object *obj, void *event_info);
extern void run_app(void *data, Evas_Object *obj, void *event_info);
extern void ic_calls_clicked(void *data, Evas_Object *obj, void *event_info);
extern void ic_sms_clicked(void *data, Evas_Object *obj, void *event_info);
extern int clock_func(void *data);
extern void cb_sms_clicked(void *data, Evas_Object *obj, void *event_info);
extern void cb_log_clicked(void *data, Evas_Object *obj, void *event_info);
extern void cb_con_clicked(void *data, Evas_Object *obj, void *event_info);
extern void populate_contact_list();
extern void del_contact (char *num);
extern void cb_channel_clicked(void *data, Evas_Object *obj, void *event_info);
extern void cb_hs_clicked(void *data, Evas_Object *obj, void *event_info);
extern void set_bt_add(void *data, Evas_Object *obj, void *event_info);
extern void add_toolbar_items(void);
extern void clock_back_clicked(void *user_data, Evas_Object *obj, const char *em, const char *src);
extern void settings_clicked(void *user_data, Evas_Object *obj, const char *em, const char *src);
extern void close_win(void *data, Evas_Object *obj, void *event_info);
extern void add_pref_toolbar_items(void);
extern void set_seq_page(char *type);
extern void reload_alarms(int *t);

void show_prefs(void *data, Evas_Object *obj, void *event_info);

extern int m_sms, m_calls, sms, in_calls;
extern Evas_Object *win, *ic_sms, *ic_calls, *sms_lb, *call_lb, *toolbar, *ic_noti, *log_list;
extern Ecore_Timer *timer;
extern Ecore_X_Window my_win, focus_win;

extern void populate_app_list(Evas_Object *list);
extern void add_hs_items(Evas_Object *win, Evas_Object *bx, Evas_Object *bt, int i);
extern int get_apps(char *cat);
extern void change_seq(Evas_Object *li);
extern char noti_app[20][255], noti_mess[20][255], noti_launch[20][255], hs_add[255];
